package 算法部分.移动数字0;

class Solution {
    public void moveZeroes(int[] nums) {
        int zeroIndex = -1;
        int zeroCount = 0;
        int len = nums.length;
        for(int i =len-1;i>=0;i--){
            if(nums[i]==0){
                zeroIndex=i;
                for(int j=zeroIndex;j<len-1;j++){
                    nums[j]=nums[j+1];
                }
                nums[len-1-zeroCount]=0;
                zeroCount++;
            }
        }
    }

    public static void main(String[] args) {
        Solution solution = new Solution();
        solution.moveZeroes(new int[]{0,1,0,3,12});
    }
}